import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/pages/classify/entity/classify_data_entity.dart';

ClassifyDataEntity $ClassifyDataEntityFromJson(Map<String, dynamic> json) {
  final ClassifyDataEntity classifyDataEntity = ClassifyDataEntity();
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    classifyDataEntity.isSelected = isSelected;
  }
  final double? id = jsonConvert.convert<double>(json['id']);
  if (id != null) {
    classifyDataEntity.id = id;
  }
  final String? className = jsonConvert.convert<String>(json['className']);
  if (className != null) {
    classifyDataEntity.className = className;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    classifyDataEntity.image = image;
  }
  final ClassifyDataApiClassAdvGetListVO? apiClassAdvGetListVO = jsonConvert.convert<ClassifyDataApiClassAdvGetListVO>(json['apiClassAdvGetListVO']);
  if (apiClassAdvGetListVO != null) {
    classifyDataEntity.apiClassAdvGetListVO = apiClassAdvGetListVO;
  }
  final double? sid = jsonConvert.convert<double>(json['sid']);
  if (sid != null) {
    classifyDataEntity.sid = sid;
  }
  final List<ClassifyDataChildren>? children = (json['children'] as List<dynamic>?)?.map((e) => jsonConvert.convert<ClassifyDataChildren>(e) as ClassifyDataChildren).toList();
  if (children != null) {
    classifyDataEntity.children = children;
  }
  return classifyDataEntity;
}

Map<String, dynamic> $ClassifyDataEntityToJson(ClassifyDataEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['isSelected'] = entity.isSelected;
  data['id'] = entity.id;
  data['className'] = entity.className;
  data['image'] = entity.image;
  data['apiClassAdvGetListVO'] = entity.apiClassAdvGetListVO?.toJson();
  data['sid'] = entity.sid;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  return data;
}

extension ClassifyDataEntityExtension on ClassifyDataEntity {
  ClassifyDataEntity copyWith({
    bool? isSelected,
    double? id,
    String? className,
    String? image,
    ClassifyDataApiClassAdvGetListVO? apiClassAdvGetListVO,
    double? sid,
    List<ClassifyDataChildren>? children,
  }) {
    return ClassifyDataEntity()
      ..isSelected = isSelected ?? this.isSelected
      ..id = id ?? this.id
      ..className = className ?? this.className
      ..image = image ?? this.image
      ..apiClassAdvGetListVO = apiClassAdvGetListVO ?? this.apiClassAdvGetListVO
      ..sid = sid ?? this.sid
      ..children = children ?? this.children;
  }
}

ClassifyDataApiClassAdvGetListVO $ClassifyDataApiClassAdvGetListVOFromJson(Map<String, dynamic> json) {
  final ClassifyDataApiClassAdvGetListVO classifyDataApiClassAdvGetListVO = ClassifyDataApiClassAdvGetListVO();
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    classifyDataApiClassAdvGetListVO.fileUrl = fileUrl;
  }
  final double? jumpType = jsonConvert.convert<double>(json['jumpType']);
  if (jumpType != null) {
    classifyDataApiClassAdvGetListVO.jumpType = jumpType;
  }
  final ClassifyDataApiClassAdvGetListVOContent? content = jsonConvert.convert<ClassifyDataApiClassAdvGetListVOContent>(json['content']);
  if (content != null) {
    classifyDataApiClassAdvGetListVO.content = content;
  }
  return classifyDataApiClassAdvGetListVO;
}

Map<String, dynamic> $ClassifyDataApiClassAdvGetListVOToJson(ClassifyDataApiClassAdvGetListVO entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['fileUrl'] = entity.fileUrl;
  data['jumpType'] = entity.jumpType;
  data['content'] = entity.content?.toJson();
  return data;
}

extension ClassifyDataApiClassAdvGetListVOExtension on ClassifyDataApiClassAdvGetListVO {
  ClassifyDataApiClassAdvGetListVO copyWith({
    String? fileUrl,
    double? jumpType,
    ClassifyDataApiClassAdvGetListVOContent? content,
  }) {
    return ClassifyDataApiClassAdvGetListVO()
      ..fileUrl = fileUrl ?? this.fileUrl
      ..jumpType = jumpType ?? this.jumpType
      ..content = content ?? this.content;
  }
}

ClassifyDataApiClassAdvGetListVOContent $ClassifyDataApiClassAdvGetListVOContentFromJson(Map<String, dynamic> json) {
  final ClassifyDataApiClassAdvGetListVOContent classifyDataApiClassAdvGetListVOContent = ClassifyDataApiClassAdvGetListVOContent();
  final double? linkType = jsonConvert.convert<double>(json['link_type']);
  if (linkType != null) {
    classifyDataApiClassAdvGetListVOContent.linkType = linkType;
  }
  final double? linkId = jsonConvert.convert<double>(json['link_id']);
  if (linkId != null) {
    classifyDataApiClassAdvGetListVOContent.linkId = linkId;
  }
  final String? linkTitle = jsonConvert.convert<String>(json['link_title']);
  if (linkTitle != null) {
    classifyDataApiClassAdvGetListVOContent.linkTitle = linkTitle;
  }
  return classifyDataApiClassAdvGetListVOContent;
}

Map<String, dynamic> $ClassifyDataApiClassAdvGetListVOContentToJson(ClassifyDataApiClassAdvGetListVOContent entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['link_type'] = entity.linkType;
  data['link_id'] = entity.linkId;
  data['link_title'] = entity.linkTitle;
  return data;
}

extension ClassifyDataApiClassAdvGetListVOContentExtension on ClassifyDataApiClassAdvGetListVOContent {
  ClassifyDataApiClassAdvGetListVOContent copyWith({
    double? linkType,
    double? linkId,
    String? linkTitle,
  }) {
    return ClassifyDataApiClassAdvGetListVOContent()
      ..linkType = linkType ?? this.linkType
      ..linkId = linkId ?? this.linkId
      ..linkTitle = linkTitle ?? this.linkTitle;
  }
}

ClassifyDataChildren $ClassifyDataChildrenFromJson(Map<String, dynamic> json) {
  final ClassifyDataChildren classifyDataChildren = ClassifyDataChildren();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    classifyDataChildren.id = id;
  }
  final String? className = jsonConvert.convert<String>(json['className']);
  if (className != null) {
    classifyDataChildren.className = className;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    classifyDataChildren.image = image;
  }
  final double? sid = jsonConvert.convert<double>(json['sid']);
  if (sid != null) {
    classifyDataChildren.sid = sid;
  }
  final List<ClassifyDataChildrenChildren>? children = (json['children'] as List<dynamic>?)?.map((e) => jsonConvert.convert<ClassifyDataChildrenChildren>(e) as ClassifyDataChildrenChildren).toList();
  if (children != null) {
    classifyDataChildren.children = children;
  }
  return classifyDataChildren;
}

Map<String, dynamic> $ClassifyDataChildrenToJson(ClassifyDataChildren entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['className'] = entity.className;
  data['image'] = entity.image;
  data['sid'] = entity.sid;
  data['children'] = entity.children?.map((v) => v.toJson()).toList();
  return data;
}

extension ClassifyDataChildrenExtension on ClassifyDataChildren {
  ClassifyDataChildren copyWith({
    String? id,
    String? className,
    String? image,
    double? sid,
    List<ClassifyDataChildrenChildren>? children,
  }) {
    return ClassifyDataChildren()
      ..id = id ?? this.id
      ..className = className ?? this.className
      ..image = image ?? this.image
      ..sid = sid ?? this.sid
      ..children = children ?? this.children;
  }
}

ClassifyDataChildrenChildren $ClassifyDataChildrenChildrenFromJson(Map<String, dynamic> json) {
  final ClassifyDataChildrenChildren classifyDataChildrenChildren = ClassifyDataChildrenChildren();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    classifyDataChildrenChildren.id = id;
  }
  final String? className = jsonConvert.convert<String>(json['className']);
  if (className != null) {
    classifyDataChildrenChildren.className = className;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    classifyDataChildrenChildren.image = image;
  }
  final double? sid = jsonConvert.convert<double>(json['sid']);
  if (sid != null) {
    classifyDataChildrenChildren.sid = sid;
  }
  return classifyDataChildrenChildren;
}

Map<String, dynamic> $ClassifyDataChildrenChildrenToJson(ClassifyDataChildrenChildren entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['className'] = entity.className;
  data['image'] = entity.image;
  data['sid'] = entity.sid;
  return data;
}

extension ClassifyDataChildrenChildrenExtension on ClassifyDataChildrenChildren {
  ClassifyDataChildrenChildren copyWith({
    String? id,
    String? className,
    String? image,
    double? sid,
  }) {
    return ClassifyDataChildrenChildren()
      ..id = id ?? this.id
      ..className = className ?? this.className
      ..image = image ?? this.image
      ..sid = sid ?? this.sid;
  }
}
